package cn.itcast.bos.dao.system;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import cn.itcast.bos.domain.system.User;

public interface UserRepository extends JpaRepository<User, Integer> {

	// 说明：根据用户名查询用户对象

	public User findByUsername(String username);

	// 根据激活时间修改用户状态
	// 更新用户锁定状态
	@Query(value = "UPDATE t_user t SET t.status='0' WHERE months_between(SYSDATE,t.activetime)>?", nativeQuery = true)
	@Modifying
	public void updateUserStatusByActivetimeForLock(Integer monthNumber);

}
